package demo01;

public class java_06 {
	public static void main(String[] args) {
		FizzBuzz fizzBuzz = new FizzBuzz(15);
		Thread threadA = new Thread(() -> {
			try {
				fizzBuzz.fizz(() -> System.out.print("fizz,"));
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		});

		Thread threadB = new Thread(() -> {
			try {
				fizzBuzz.buzz(() -> System.out.print("buzz, "));
			} catch (InterruptedException e) {
				e.printStackTrace();	            }
		});

		Thread threadC = new Thread(() -> {
			try {
				fizzBuzz.fizzbuzz(() -> System.out.print("fizzbuzz, "));
			} catch (InterruptedException e) {
				e.printStackTrace();	            }
		});

		Thread threadD = new Thread(() -> {
			try {
				fizzBuzz.number(number -> System.out.print(number + ", "));
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		});

		threadA.start();
		threadB.start();
		threadC.start();
		threadD.start();

		try {
			threadA.join();
			threadB.join();
			threadC.join();
			threadD.join();
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}
}